#ifndef _DEBUG_H_
# define _DEBUG_H_

# ifdef _DEBUG
#  include <iostream>

#  define CTOR(name, object) std::cout << "CTOR: 0x" << (void*)object << " (" << name << ")" << std::endl
#  define DTOR(name, object) std::cout << "DTOR: 0x" << (void*)object << " (" << name << ")" << std::endl
#  define CERR(message) std::cerr << "Error: " << message << std::endl
#  define FATAL_ERR(error) std::cerr << "Fatal error: " << error << std::endl;
# else
#  define CTOR(object, name)
#  define DTOR(object, name)
#  define CERR(message)
#  include <windows.h>
#  define FATAL_ERR(error) \
			{ \
				int a = lstrlenA(error); \
				BSTR unicodestr = SysAllocStringLen(NULL, a); \
				::MultiByteToWideChar(CP_ACP, 0, error, a, unicodestr, a); \
				MessageBox(0, unicodestr, L"Fatal error",0); \
				::SysFreeString(unicodestr); \
			}
# endif

#endif // _DEBUG_H_
